<?php
$this->breadcrumbs=array(
	'My History',
);

?>

<h1><?php echo 'Naldi' ?>'s History</h1>
<div>
<?php
$this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'MyHistory-grid',
	'dataProvider'=>$model_rapat->search(),
	'filter' => $model_rapat,
    'columns'=>array(
		array(
			'header' => 'Request ID',
			'name' => 'requestKonsumenId',		
           'filter' => CHtml::activeTextField($model_rapat,'requestKonsumenId'),
     //   'filter' => CHtml::listData(KonsumsiRapat::model()->findAll(),'id','requestKonsumen.id'), // fields from country table
		//'value' => 'requestKonsumen::Model()->FindByPk($data->id)->id',
          'value'=>'isset($data->requestKonsumen)?$data->requestKonsumen->id:""',
		//'filter'=>CHtml::listData(RequestKonsumen::model()->findAll(array('order'=>'id ASC')), 'id', 'id')
		
		//'value' => '$data->requestKonsumen->id',
				
			),
		array(
			'header'=>'Tanggal Dibutuhkan',
			'name' =>'date',
			'value'=>'$data->formatDate($data->date)',
				
		),
		array(
			'header' => "Tipe Makanan & Jumlah",		
			'value' => '$data->getTypeMakanan()',
	   //'filter' => CHtml::activeDropDownList($model_rapat,'typeMakanan',$typeMakanan),
			'filter'=> false,		
		),
		array(
			'header' => "Jumlah",
			'value' => '$data->getJumlahMakanan()',
		),			
		array(
			'header' => "Waktu Dibutuhkan",
			'name' => 'time_start',
		),
	
		array(
			'header' => "Status Pesanan",
           //'filter' => CHtml::activeTextField($model_rapat,'requestKonsumenStatus'),

	    'filter' => CHtml::activeDropDownList($model_rapat,'requestKonsumenStatus',array(''=>'','Taken'=>'Taken','Approved'=>'Approved','Rejected'=>'Rejected','Waiting'=>'Waiting')),
	//     'filter' => CHtml::listData(RequestKonsumen::model()->findAll(), 'rapat_id', 'status'),
			
		
			'name' => 'requestKonsumenStatus',
			'value' => 'requestKonsumen::Model()->FindByPk($data->id)->status',
		
		//	'value' => '$data->requestKonsumen->status'
			
		),		
        array(    
        	'header' => 'Aksi',        // display a column with "view", "update" and "delete" buttons
            'class'=>'CButtonColumn',
        	'template'=> '{view}{delete}',
        
        	'buttons'=>array(
        		'delete' => array(
        			'visible' => '$data->requestKonsumen->status=="waiting"'
        		),
        	),
        	//'{view}{delete}',//bisa ditambahin {button1}
        	//'buttons'=>array(
        		//	'button1' => array(
        			//	'label' => 'Button1',
        			//),
        	//	),
        ),
    ),
));?>
</div>
<div id=transaksi>
<!-- kalo misalnya diajax ato klik ini keluar -->

</div>

